package com.jingdianjichi.interview.api.enums;

import lombok.Getter;

/**
 * ClassName:ResultCode
 * Package:com.jingdianjichi.subject.common.enums
 * Description:
 *
 * @Author fst
 * @Create 2024/9/26 16:14
 * @Version 1.0
 */

@Getter
public enum ResultCodeEnum
{
    SUCCESS(200,"成功"),
    FAIL(500,"失败");


    private int code;
    private String desc;
    ResultCodeEnum(int code,String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static ResultCodeEnum getByCode(Integer codeVal)
    {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if(resultCodeEnum.code==codeVal)
            {
                return resultCodeEnum;
            }
        }
        return null;
    }
}
